package truef.reorder.web.spring.controller;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.google.gson.Gson;

import edu.zut.cs.software.base.web.spring.controller.GenericController;
import truef.house.domain.SAdress;
import truef.reorder.domain.ReturnOrder;
import truef.service.reorder.service.ReturnOrderManager;

@Controller
//拦截含有returnOrder的url并处理
@RequestMapping("/returnOrder")//1.
public class ReturnOrderController extends GenericController<ReturnOrder, Long,ReturnOrderManager> {
	ReturnOrderManager returnOrderManager;

	/*
	 * 部署成功后，在浏览器中输入url
	 * http://localhost:8080/universalStore-web/${1.}/${2.value值}
	 * 例子:http://localhost:8080/universalStore-web/odity/index.html
	*/
	@CrossOrigin(origins = "*")
	@ResponseBody
	@RequestMapping(value = "/findall.json",produces = "text/plain;charset=utf-8")
	public String findall() {
		List<ReturnOrder> CommentList = returnOrderManager.findAll();
		Gson gson = new Gson();
		String s = gson.toJson(CommentList);
		return s;
	}

	@Autowired
	public void setUserManager(ReturnOrderManager returnOrderManager) {
		this.returnOrderManager = returnOrderManager;
		this.manager = this.returnOrderManager;
	}

}
